unit IW.ContentBot;

interface

uses
  Classes, IW.Content.Base, HTTPApp, IWApplication, IW.HTTP.Request, IW.HTTP.Reply;

type
  TContentBot = class(TContentBase)
  protected
    function Execute(aRequest: THttpRequest; aReply: THttpReply; const aPathname: string; aSession: TIWApplication;
        aParams: TStrings): boolean; override;
  public
    constructor Create; override;
  end;

implementation

uses
  IW.Content.Handlers, IWMimeTypes, IWGlobal;

constructor TContentBot.Create;
begin
  inherited;
  mFileMustExist := False;
end;

// this content handler writes dynamic html content to the reply
function TContentBot.Execute(aRequest: THttpRequest; aReply: THttpReply; const aPathname: string; aSession: TIWApplication;
 aParams: TStrings): boolean;
begin
  Result := True;
  if Assigned(aReply) then begin
    aReply.ContentType := MIME_HTML;
    aReply.WriteString(gHtmlStart);
    aReply.WriteString('This is some dynamic content generated by IntraWeb application ');
    aReply.WriteString('in response to a bot/search engine request');
    aReply.WriteString('</HTML>');
  end;
  aSession.Terminate;
end;

initialization

end.
